﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="DanhMuc.aspx.cs" Inherits="QuangMobile.Admin.DanhMuc"
    MasterPageFile="~/Admin/AdminSite.Master" %>

<asp:Content ID="Content1" runat="server" ContentPlaceHolderID="ContentPlaceHolder1">
    <div class="NoiDungChinh">
        <img class="FormImage" src="images/computer.png" />
        <p class="FormTitle" id="FormTitle" runat="server">
            Quản lý Banner</p>
    </div>
    <div class="Form Search">
        Nhập tiêu chí tìm kiếm:
        <asp:TextBox ID="txtSearch" runat="server" CssClass="SearchBox InputText"></asp:TextBox>
        <asp:Button ID="btnSearch" runat="server" Text="Tìm kiếm" CssClass="cmdBtn" OnClick="btnSearch_Click"
            CausesValidation="False" />
    </div>
    <div class="Form Update" runat="server" id="formUpdate">
        <table border="1px" class="ListForm">
            <tr>
                <th>
                    Mã danh mục
                </th>
                <td>
                    <asp:TextBox ID="txtMaDanhMuc" runat="server" Enabled="false" CssClass="InputText"></asp:TextBox>
                </td>
            </tr>
            <tr>
                <th>
                    Tên danh mục
                </th>
                <td>
                    <asp:TextBox ID="txtTenDanhMuc" runat="server" CssClass="InputText"></asp:TextBox>
                    <asp:RequiredFieldValidator ID="txtTenDanhMucVal" runat="server" ErrorMessage="Vui lòng nhập tên danh mục"
                        CssClass="formValidate" Display="Dynamic" ControlToValidate="txtTenDanhMuc"></asp:RequiredFieldValidator>
                </td>
            </tr>
            <tr>
                <td colspan="2" align="center">
                    <asp:Button ID="btnLuu" runat="server" Text="Lưu lại" CssClass="cmdBtn" OnClick="btnLuu_Click" />
                    <asp:Button ID="btnHuy" runat="server" Text="Hủy" CssClass="cmdBtn" OnClick="btnHuy_Click"
                        CausesValidation="False" />
                </td>
            </tr>
        </table>
    </div>
    <div class="Form View">
        <asp:Button ID="btnThem" runat="server" Text="Thêm mới" CssClass="cmdBtn" OnClick="btnThem_Click"
            CausesValidation="False" />
        <asp:GridView ID="grdDanhMuc" runat="server" AutoGenerateColumns="False" CssClass="ListTable"
            DataKeyNames="ID" OnRowCommand="grdDanhMuc_RowCommand">
            <Columns>
                <asp:TemplateField HeaderText="STT">
                    <ItemTemplate>
                        <asp:Label ID="lblIDDM" runat="server" Text='<%# Container.DataItemIndex + 1 %>'></asp:Label>
                    </ItemTemplate>
                    <ItemStyle HorizontalAlign="Center" />
                </asp:TemplateField>
                <asp:TemplateField HeaderText="Tên danh mục">
                    <ItemTemplate>
                        <asp:Label ID="lblTenDM" runat="server" Text='<%# Eval("TenDM") %>'></asp:Label>
                    </ItemTemplate>
                </asp:TemplateField>
                <asp:TemplateField HeaderText="Ngày tạo">
                    <ItemTemplate>
                        <asp:Label ID="lblNgayTao" runat="server" Text='<%# Eval("CreateDate") %>'></asp:Label>
                    </ItemTemplate>
                </asp:TemplateField>
                <asp:TemplateField HeaderText="Ngày cập nhật">
                    <ItemTemplate>
                        <asp:Label ID="lblNgayCapNhat" runat="server" Text='<%# Eval("UpdateDate") %>'></asp:Label>
                    </ItemTemplate>
                </asp:TemplateField>
                <asp:TemplateField HeaderText="Sửa">
                    <ItemTemplate>
                        <asp:ImageButton ID="lbtEdit" runat="server" ImageUrl="../images/edit.gif" CommandName="<%# QuangMobile.MyConst.Action.Update %>"
                            CommandArgument='<%# Eval("ID") %>'></asp:ImageButton>
                    </ItemTemplate>
                    <ItemStyle Width="10px" HorizontalAlign="Center" />
                </asp:TemplateField>
                <asp:TemplateField HeaderText="Xóa">
                    <ItemTemplate>
                        <asp:ImageButton ID="lbtDelete" runat="server" ImageUrl="../images/delete.png" CommandName="<%# QuangMobile.MyConst.Action.Delete %>"
                            OnClientClick="return confirm('Bạn có chắc là muốn xóa bản ghi này không ?')"
                            CommandArgument='<%# Eval("ID") %>'></asp:ImageButton>
                    </ItemTemplate>
                    <ItemStyle Width="10px" HorizontalAlign="Center" />
                </asp:TemplateField>
            </Columns>
        </asp:GridView>
    </div>
</asp:Content>
